package com.sooth.system.user.mapper;

import com.dream.system.annotation.Mapper;
import com.dream.system.annotation.Param;
import com.dream.system.annotation.Sql;
import com.sooth.common.dream.annotation.IgnorePermission;
import com.sooth.common.dream.annotation.IgnoreTenant;
import com.sooth.system.user.view.SysUserVo;

@Mapper
public interface SysUserMapper {

    @IgnorePermission
    @IgnoreTenant
    @Sql("select @*() from sys_user where user_name=:userName and tenant_id=:tenantId")
    SysUserVo queryUserByUserName(@Param("userName") String userName, @Param("tenantId") String tenantId);

    @Sql("update sys_user set login_ip=:loginIp,login_date=now() where user_name=:userName")
    int updateLoginInfo(@Param("userName") String userName, @Param("loginIp") String loginIp);

    @Sql("select nick_name from sys_user where id=:userId")
    SysUserVo queryNickName(@Param("userId") Long userId);
}
